<!DOCTYPE html>
<html lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>${_title}</title>

<!-- Bootstrap core CSS -->

<link href="${_css}/bootstrap.min.css" rel="stylesheet">

<link href="${_font}/css/font-awesome.min.css" rel="stylesheet">
<link href="${_css}/animate.min.css" rel="stylesheet">

<!-- Custom styling plus plugins -->
<link href="${_css}/custom.css" rel="stylesheet">
<link href="${_css}/icheck/flat/green.css" rel="stylesheet">

<!-- editor -->
<link
	href="http://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css"
	rel="stylesheet">
<link href="${_css}/editor/external/google-code-prettify/prettify.css"
	rel="stylesheet">
<link href="${_css}/editor/index.css" rel="stylesheet">

<!-- switchery -->
<link rel="stylesheet" href="${_css}/switchery/switchery.min.css" />

<script src="${_js}/jquery.min.js"></script>

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->

</head>


<body style="background: #F7F7F7;">
		<div class="row">
			<div class="col-md-12 col-sm-12 col-xs-12">
				<div class="x_panel">
					<div class="x_title">
						<h2>编辑单页面</h2>
						<div class="clearfix"></div>
					</div>
					<div class="x_content">

						<form class="form-horizontal form-label-left" novalidate>
							<div class="item form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12"
									for="title">产品名称 <span class="required">*</span>
								</label>
								<div class="col-md-6 col-sm-6 col-xs-12">
									<input type="hidden" id="pageId" value="${product.id}"></hidden>
									<input id="name" class="form-control col-md-7 col-xs-12"
										name="name" placeholder="商品名称" required="required" type="text" value="${product.name }">
								</div>
							</div>
							<div class="item form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12"
									for="title">产品年化<span class="required">*</span>
								</label>
								<div class="col-md-6 col-sm-6 col-xs-12">
									<input id="percent" class="form-control col-md-7 col-xs-12"
										name="percent" placeholder="产品年化" required="required"
										type="text" value="${product.percent }">
								</div>
							</div>
							<div class="item form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12"
									for="title">产品年化<span class="required">*</span>
								</label>
								<div class="col-md-6 col-sm-6 col-xs-12">
									<select class="form-control" id="status">
                                        <option value="Y" <#if product.status?? & product.status=="Y">selected="selected"</#if>>产品已上线</option>
                                        <option value="N" <#if product.status?? & product.status=="N">selected="selected"</#if>>产品已下线</option>
                                    </select>
								</div>
							</div>
							
							<div class="item form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12"
									for="title">产品投资有效时间<span class="required">*</span>
								</label>
								<div class="col-md-6 col-sm-6 col-xs-12">
									<input id="sum" class="form-control col-md-7 col-xs-12"
										name="sum" placeholder="产品投资有效时间" required="required" type="text">
								</div>
							</div>
							
							<div class="item form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12"
									for="title">最小投资金额<span class="required">*</span>
								</label>
								<div class="col-md-6 col-sm-6 col-xs-12">
									<input id="sum" class="form-control col-md-7 col-xs-12"
										name="sum" placeholder="最小投资金额" required="required" type="text">
								</div>
							</div>
							<div class="item form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12"
									for="title">最大投资金额<span class="required">*</span>
								</label>
								<div class="col-md-6 col-sm-6 col-xs-12">
									<input id="sum" class="form-control col-md-7 col-xs-12"
										name="sum" placeholder="最大投资金额" required="required" type="text">
								</div>
							</div>
						</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>

	<div class="row">
		<div class="col-md-12 col-sm-12 col-xs-12"
			style="margin-bottom: 50px;">
			<div class="ln_solid"></div>
			<div class="form-group">
				<div class="col-md-12 col-md-offset-5">
					<button type="button" onclick="javascript:history.go(-1)"
						class="btn btn-primary">返回前一页</button>
					<button id="save" type="button" class="btn btn-success">保存</button>
				</div>
			</div>
		</div>
	</div>
	</div>
	<script src="${_js}/bootstrap.min.js"></script>
    <!-- bootstrap progress js -->
	<script src="${_js}/progressbar/bootstrap-progressbar.min.js" type="text/javascript"></script>
	<script src="${_js}/nicescroll/jquery.nicescroll.min.js" type="text/javascript"></script>

    <!-- chart js -->
    <script src="${_js}/custom.js"></script>
    <!-- dropzone -->
    <script src="${_js}/dropzone/dropzone.js" type="text/javascript" ></script>
    <!-- PNotify -->
	<script src="${_js}/notify/pnotify.core.js" type="text/javascript"></script>
	<script src="${_js}/notify/pnotify.buttons.js" type="text/javascript"></script>
	<script src="${_js}/notify/pnotify.nonblock.js" type="text/javascript" ></script>
	<!-- richtext editor -->
    <script src="${_js}/editor/bootstrap-wysiwyg.js"></script>
    <script src="${_js}/editor/external/jquery.hotkeys.js"></script>
    <script src="${_js}/editor/external/google-code-prettify/prettify.js"></script>
	<script type="text/javascript">
		$("#save").click(function(){
			var id = $("#pageId").val();
			var name = $('#name').val();
			var percent = $("#percent").val();
			var status=$.trim($("#status").val());
			$.ajax({
				type : 'POST',
				dataType : 'JSON',
				async : 'false',
				url : '/admin/product/saveOrUpdate',
				data : {
					"id":id,
					"name":name,
					"percent":percent,
					"status":status
				},
				success : function(result) {
					if (result.code == -1) {
						alert("操作成功!");
						window.location.href = "/admin/product/list";
					} else {
						alert(result.msg);
					}
				}
			})
		})
	</script>
</body>

</html>